package com.ayf.payment.game.api.task.settle;

import com.swwx.charm.zookeeper.exception.GetLockFailedException;
import com.swwx.charm.zookeeper.lock.DistributedLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author ad
 * @Title: OrderSettleTask
 * @Copyright: Copyright (c) 2020
 * @Description: <br>
 * @Company: a.com
 * @Created on 2020/10/2217:34
 */
@Component
public class OrderSettleTask extends OrderSettleTaskBasic {

    @Autowired
    protected DistributedLock distributedLock;

    @Autowired
    protected TaskExecutor orderSettleTask;

    @Scheduled(cron = "5 0 10 * * ?")
    public void run() throws GetLockFailedException {
        super.run(distributedLock);
    }

    @Override
    public void submit(Runnable task) {
        orderSettleTask.execute(task);
    }
}
